#案例：测试数据存储在yaml文件中，通过pyyaml库的相关函数来读取这些数据，并把这些数据拼接成[{},{}]

import yaml

# with open("../data/login.yaml") as fp:
#     ret=yaml.safe_load(fp)
#
#
# result=[]
# fenlei1=ret["test_login_001"]
#
# for key,value in fenlei1.items():
#     x={}
#     x["key"] = key
#     for k,v in value.items():
#         x[k]=v
#     result.append(x)
#
# print(result)


import yaml

#带测试用例编号key一起读取！[{},{}]
def read_cesiData(file_name, key):
    with open(file_name, "r") as f:
        data = yaml.load(f,Loader=yaml.FullLoader)[key]
        ret = list()
        for k in data.keys():
            v=data[k];
            v["key"]=k;
            ret.append(v);
        return ret





